import {http} from "@/api/index";

const menu = {
    getMenuTree:'/menu/tree',
    addMenu:'/menu/add',
    deleteMenuById:'/menu/delete',
    updateMenu:'/menu/update',
    findCheckedTree:'/menu/findCheckedTree',
    addOrDeleteRoleMenu:'/menu/addOrDeleteRoleMenu',
    findLeftMenuAntTabs:'/menu/findLeftMenuAndTabs'
}


export const getMenuTree = (params)=>{
    return http.request({
        url:menu.getMenuTree,
        method:'get',
        params: params
    })
}
export const addMenu = (params)=>{
    return http.request({
        url:menu.addMenu,
        method:'post',
        data:params
    })
}
export const deleteMenuById = (menuId)=>{
    return http.request({
        url:menu.deleteMenuById,
        method:'get',
        params:{
            menuId:menuId
        }
    })
}
export const updateMenu = (params)=>{
    return http.request({
        url:menu.updateMenu,
        method:'post',
        data:params
    })
}
export const findMenuCheckedKeys = (roleId)=>{
    return http.request({
        url:menu.findCheckedTree,
        method:'get',
        params:{
            roleId
        }
    })
}
export const addRoleMenu = (params)=>{
    return http.request({
        url:menu.addOrDeleteRoleMenu,
        method:'post',
        data:params
    })
}
export const findLeftMenuAntTabs = ()=>{
    return http.request({
        url:menu.findLeftMenuAntTabs,
        method:'get'
    })
}
